package com.geo.geotool.controller;


import com.geo.geotool.base.entity.RetEntity;
import com.geo.geotool.base.entity.RetResponse;
import com.geo.geotool.entity.sql.QFeatureEntity;
import com.geo.geotool.entity.sql.SFeatureEntity;
import com.geo.geotool.service.IFeatureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * • @Description: 要素服务实现
 * • @author  : yell
 * • @date : 2021/11/18  14:29
 */
@RestController
@RequestMapping("feature")
public class FeatureController {
    IFeatureService featureService;
    @Autowired
    public void setFeatureService(IFeatureService featureService){
        this.featureService = featureService;
    }

    /**
     * 保存feature
     * @param sFeatureEntity
     * @return
     */
    @RequestMapping("save")
    @ResponseBody
    public RetEntity saveFeature(@RequestBody SFeatureEntity sFeatureEntity) throws Exception{
        featureService.saveFeature(sFeatureEntity);
        return RetResponse.makeOKRsp();
    }


    /**
     * 插入feature
     * @param qFeatureEntity
     * @return
     */
    @RequestMapping("query")
    @ResponseBody
    public RetEntity queryFeature(@RequestBody QFeatureEntity qFeatureEntity) throws Exception {
        List<Map> featureList = featureService.queryFeature(qFeatureEntity);
        return RetResponse.makeOKRsp(featureList);
    }


    @RequestMapping("transJSONString")
    @ResponseBody
    public RetEntity transJSONString(String jsonString , String requiredFormat,String wkId,String requireWkId) throws Exception{

        return null;
    }

}
